package cn.joyfulmedia.common.util.page;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

/**
 * 管理后台分页返回对象
 */
public class PageVO<T> implements Serializable {

	private static final long serialVersionUID = -4204045025890333178L;
	/**
	 * 结果list
	 */
	private List<T> list;

	/**
	 * 处理分页组件
	 */
	private Pagination pagination;

	public PageVO() {
	}

	public PageVO(List<T> list, Pagination pagination) {
		super();
		this.list = list;
		this.pagination = pagination;
	}

	public static final <T> PageVO<T> emptyPage(Pagination pagination) {
		List<T> list = Collections.emptyList();
		return new PageVO<T>(list, pagination);
	}

	public static final <T> PageVO<T> emptyPage(int pageNo, int pageSize) {
		List<T> list = Collections.emptyList();
		return new PageVO<T>(list, new Pagination(pageSize, pageNo));
	}

	public List<T> getList() {
		return this.list;
	}

	public void setList(List<T> list) {
		this.list = list;
	}

	public Pagination getPagination() {
		return this.pagination;
	}

	public void setPagination(Pagination pagination) {
		this.pagination = pagination;
	}

}
